import { breadthSearch } from '../../Configure/Common'

export const middleware = async (url, OptionsEvent, uuid, actionRef) => {
    console.info('ROT页面路径 -', url)
    const ClientData = JSON.parse(localStorage.getItem('ClientData'))
    const MENU = JSON.parse(sessionStorage.getItem('MENU'))
    const Permission = breadthSearch(MENU, 'targetUrl', url)?.children
    const Template = await import(`./FirstLevel/${url}`).catch(() => false)
    if (Template) return await Template[url]({ uuid, url, OptionsEvent, ClientData, Permission, actionRef })
    else return false
}
